package models

import (
	"example.com/myproject/project/global"
	"time"
)

type Aircraft struct {
	AircraftID          uint      `gorm:"primaryKey"` // 主键
	CurrentFlightNumber *int      // 外键，关联航班,可为空
	Model               string    `gorm:"not null"` // 型号
	SeatCount           int       `gorm:"not null"` // 座位数量
	ServiceStartTime    time.Time // 开始服务时间

	//CurrentFlight Flight `gorm:"foreignKey:FlightNumber"` 关联航班
}

func AddAircraft(aircraft Aircraft) error {
	if global.Db.Create(&aircraft).Error != nil {
		return global.Db.Error
	}
	return nil
}
